<!-- 表信息 -->
<template>
  <div class="table-info">
    <el-descriptions :column="1">
      <el-descriptions-item label="模型名称">
        {{ tableInfo.modelName || "---" }}
      </el-descriptions-item>
      <el-descriptions-item label="模型编码">
        {{ tableInfo.modelCode || "---" }}
      </el-descriptions-item>
      <el-descriptions-item label="数据源">
        {{ dataSourceName }}
      </el-descriptions-item>
      <el-descriptions-item label="模式名">
        {{
          tableInfo.createStyle
            ? tableInfo.createStyle == "1"
              ? "DDL"
              : "向导模式"
            : "---"
        }}
      </el-descriptions-item>
      <el-descriptions-item label="域">
        {{ tableInfo.schemaName || schemaInfo.name || "---" }}
      </el-descriptions-item>
      <el-descriptions-item label="描述">
        {{ tableInfo.modelDescription || "无" }}
      </el-descriptions-item>
      <el-descriptions-item label="冷热度">
        {{ tableInfo.remark || 0 }}
      </el-descriptions-item>
      <!-- TODO 建表DDL展示 -->
      <!-- <el-descriptions-item label="建表DDL">

      </el-descriptions-item> -->
    </el-descriptions>
  </div>
</template>
<script>
export default {
  name: "TableInfo",
  props: {
    tableInfo: {
      type: Object,
      default: () => {},
    },
    schemaInfo: {
      type: Object,
      default: () => {},
    },
    dataSources: {
      type: Array,
      default: () => [],
    },
  },
  computed: {
    dataSourceName() {
      const source = this.dataSources.find(
        (ele) => String(ele.dataSourceId) === this.tableInfo.dataSourceId
      );
      return source?.dataBaseAddress || "---";
    },
  },
};
</script>
<style lang="scss" scoped>
.table-info {
  height: 100%;
  overflow-y: auto;
}
</style>
